package dataMapper;

import java.io.BufferedReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import dataEntity.DataElementDescription;

public class DataElementDescriptionMapper {
	public static  Map<String,DataElementDescription> process(BufferedReader br){
		Map<String,DataElementDescription> map = new HashMap<String,DataElementDescription>();
		try {
			br.readLine();
			while(br.ready()){
				DataElementDescription object = buildObject(br.readLine());

//				map.put(object.getCHSI_State_Abbr() + "," + object.getCHSI_County_Name(), object);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return map;
	}
	
	public static  DataElementDescription buildObject(String inLine){
		String[] line = inLine.split(",");
		DataElementDescription object = new DataElementDescription();
		
		object.setPAGE_NAME(line[0]);
		object.setCOLUMN_NAME(line[1]);
		object.setDATA_TYPE(line[2]);
		object.setIS_PERCENT_DATA(line[3]);
		object.setDESCRIPTION(line[4]);
		object.setREFERENCE(line[5]);

		return object;
	}
}
